How far the picture leans sideways. 0 is upright; a positive number slides the top to the right (and the bottom to the left), like italic writing. It is how many pixels the top slides for every pixel of height, so 0.5 on a sprite 32 pixels tall puts the top 8 pixels right of the middle.
Works differently on Game Boy - A turned, resized or leaned sprite shows the nearest look the build draws ahead of time: turns in steps (Project Settings: Sprite turn steps), a few sizes and leans, and a negative size mirrors exactly. The looks share the 384 tiles of video memory, so there is room for few.
Works differently on Game Boy Color - On the Game Boy Color a turned, resized or leaned sprite shows the nearest of the looks the build drew ahead of time: turns in steps (Project Settings: Sprite turn steps), a few sizes and leans. A negative size mirrors it exactly.
Sega Genesis: not available
On other consoles this differs: see Side by side and How the consoles differ.
xshear: realHow far the picture leans sideways. 0 is upright. A positive number slides the top of the picture to the right and the bottom to the left, like italic writing. A negative number leans it the other way.
The number is how many pixels the top slides for every pixel of height, so it means the same thing at any size. On a sprite 32 pixels tall, 0.5 puts the top 8 pixels to the right of the middle and the bottom 8 pixels to the left. 1 is a lean of 45 degrees: the top is as far sideways as it is high.


A striped lighthouse, upright on the left and leaning on the right. The top of the picture slides sideways; the bottom stays where it was. Real pictures from a Game Boy Advance ROM.
It is not the same as turning the picture. angle keeps every corner square; a lean slants the picture without turning it, so the sides tilt and the top and bottom stay level. You cannot get that look from angle at all.
The picture leans about the sprite's origin, not about its middle. A character whose origin is at its feet leans with its feet planted, and one whose origin is in the middle leans about the middle. If you flip the sprite with flip_x or a negative xscale, the lean stays on the same side of the screen.
Default drawing and draw_self both lean the picture. For a copy of the picture that leans differently from the object itself, such as a shadow, use draw_sprite_sheared. yshear is the same idea in the other direction.
xshear = 0.4;The picture leans right. On a sprite 32 pixels tall, the top is about 6 pixels right of the middle.
xshear = 0.15 * hsp;The faster this object moves right, the more its top slides right, and it leans left when it moves left. A running character that leans into its run.
xshear = xshear * 0.8;Every frame the lean shrinks to four fifths of what it was, so it eases back to upright. Set xshear = 0.6; when something hits the object and it leans, then springs back.


That spring-back, one real picture for each of the 14 frames after the hit, played in a loop (the caption under the picture is the lean at that moment). The upright lighthouse on the left is there to measure against. It plays about five times slower than the console runs it, so you can follow it; a viewer that does not animate shows the first frame, the lean at the hit.
A leaned sprite is drawn with the same hardware matrix that angle and the scales use, so it takes one of the 32 matrices the console has for as long as it is leaned - see Budgets. A sprite that is not leaned, not turned and not scaled takes none.
The matrix comes back the moment everything is exactly plain again - xshear and yshear exactly 0, angle exactly 0, the scales exactly 1. Measured on a real console, over and over, for a leaned sprite, a turned one and a scaled one. But a lean that creeps toward 0 and never gets there keeps its matrix for as long as the object lives, even when it is too small to see. A spring is the usual way to do that: with xshear_vel += (0 - xshear) * 0.2; xshear_vel *= 0.8; xshear += xshear_vel; the lean stalls at about -0.0105, and a test of "less than 0.01" never fires. So end a spring on exactly 0, with a test the motion really reaches:
if (abs(xshear) < 0.03 and abs(xshear_vel) < 0.03) {
xshear = 0;
xshear_vel = 0;
}Only the objects that use it pay for it. xshear and yshear are not part of every object. A family of objects (a parent and its children) carries them, 16 bytes for each object in it, only when a script of that family mentions xshear or yshear, or a room sets one. Every object in a game that never leans anything is exactly as big as it was.
A leaned sprite that stands still costs almost nothing. Like any other sprite, one that has not changed since last frame is skipped. Moving the lean every frame costs a bit more than moving angle every frame, since both numbers go through one extra step.
The number is exact while angle is 0. With a turn as well, the picture is still leaned, but the lean no longer lines up with the rows and columns of the screen, so keep angle at 0 when you want a clean slant.
The hardware draws a leaned sprite into a box no bigger than twice its own size. A lean wide enough to push the picture past that is cut off: on a square sprite the corners start to disappear when xshear goes past 1 or below -1. Anything past about 120 is held at 120.
A sprite that is leaned, turned a little, or made a little bigger is drawn into that bigger box every time - the engine asks for it - so none of its edge pixels are lost. See Budgets for what the bigger box costs on a crowded row of the screen.